﻿@model PagedList.IPagedList<blogDemo.Models.artic>
@using PagedList
@using PagedList.Mvc

@{
    ViewBag.Title = "文章管理";
}

<h2>文章管理</h2>

<table class="table table-bordered table-striped">
    <tr class="text-center">
        <th>
            标题
        </th>
        <th>
            作者
        </th>
        <th>
            阅读次数
        </th>
        <th>
            日期
        </th>
        <th>
            操作
        </th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.author)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.views)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.date)
            </td>
            <td>
                <button class="btn btn-sm">@Html.ActionLink("修改", "Edit", new { id = item.ID })</button>
                <button class="btn btn-sm">@Html.ActionLink("阅读", "Details", new { id = item.ID })</button>
                <button class="btn btn-sm">@Html.ActionLink("删除", "Delete", new { id = item.ID })</button>
            </td>
        </tr>
    }

</table>
<p>
    &nbsp;@Html.ActionLink("创建新文章", "Create")
</p>
<div class="text-center">
    @Html.PagedListPager(Model, page => Url.Action("Index", new { page }))
</div>
